package cn.com.taiji.oospub.wechat.entity;


import cn.com.taiji.oospub.wechat.common.Finals;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.dreamyoung.mprelation.AutoLazy;
import com.github.dreamyoung.mprelation.EntityMapper;
import com.github.dreamyoung.mprelation.JoinColumn;
import com.github.dreamyoung.mprelation.ManyToOne;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 *
 * </p>
 *
 * @author yzd
 * @since 2020-10-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("member_base_info")
@AutoLazy
public class MemberBaseInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    @TableField("Login_Name")
    @JsonProperty(value = "loginName")
    private String loginName;

    @TableField("Passwd")
    private String Passwd;
    @TableField(exist = false)
    private String oldPasswd;// 老密码
    @TableField(exist = false)
    private String confirmPwd;  //确认密码

    @TableField("School_Id")
    private String schoolId;

    @TableField(exist = false)
    @EntityMapper
    @ManyToOne
    @JoinColumn(name = "school_id", referencedColumnName = "ID")
    private SchoolBaseInfo school;

    @TableField("Name")
    @JsonProperty(value = "Name")
    private String Name = "匿名用户";

    @TableField("User_Age")
    private Double userAge;

    @TableField("Male")
    @JsonProperty(value = "Male")
    private String Male;

    @TableField("Email")
    @JsonProperty(value = "Email")
    private String Email;

    @TableField("Mobile")
    @JsonProperty(value = "Mobile")
    private String Mobile;

    @TableField("Register_Time")
    private LocalDateTime registerTime;

    @TableField("Auditer")
    private String Auditer;

    @TableField("Audit_Time")
    private LocalDateTime auditTime;

    @TableField("Status")
    private MemberStatus Status;

    @TableField("Remark")
    private String Remark;

    @TableField("Id_Number")
    private String idNumber;

    private String zfPasswd;

    private Double weightId;

    private Double height;

    private String openid;

    private String agreeService = "1";

    private double aimWeigth;

    @TableField("ACTIVE")
    private Active active;

    @TableField("startAddress")
    private String startAddress;

    @TableField("aimAddress")
    private String aimAddress;

    @TableField("aimPoint")
    private String aimPoint;

    @TableField("orderType")
    private String orderType;

    @TableField("getaimAddress")
    private String getaimAddress;

    @TableField("getOrderTime")
    private String getOrderTime;

    @TableField("ZhOrEn")
    private Finals.ZhOrEn zhOrEn = Finals.ZhOrEn.Z;

    @TableField("posNum")
    private String posNum;

    @TableField("customer_type")
    private String customerType;

    @TableField("patient_number")
    private String patientNumber;


    //临时字段


    //当前用户的session id
    @TableField(exist = false)
    private String sessionId;
    //当前用户的ip地址
    @TableField(exist = false)
    private String ip;
    @TableField(exist = false)
    //当前用户第一次访问的时间
    private String firstTime;


    @TableField(exist = false)
    private String headImg;//头像

    @TableField(exist = false)
    @JsonProperty(value = "schoolCode")
    private String schoolCode;
    @TableField(exist = false)
    private Double bmi;
    @TableField(exist = false)
    private String isStaff;//是否员工
    @TableField(exist = false)
    private Double minimumConsumptionAmount = 0d;//补助卡最低消费金额
    @TableField(exist = false)
    private Double maxAllowance = 0d;//单餐最大优惠金额
    @TableField(exist = false)
    private Double allowanceAmount = 0d;//补助金额
    /**
     * pos取个人信息时
     * 返回时的错误编码临时变量
     */
    @TableField(exist = false)
    private String responseCode;
    /**
     * pos取个人信息时
     * 返回时的错误描述信息
     */

    @TableField(exist = false)
    private String activeStr;
    @TableField(exist = false)
    private String responseDesc;
    @TableField(exist = false)
    private String statusStr;
    @TableField(exist = false)
    private String architecture;
    @TableField(exist = false)
    private String hisSpaceID;

    @TableField(exist = false)
    private Restaurant restaurant;//当前选择餐厅
    @TableField(exist = false)
    private String receiveAddress;//配送地址
    @TableField(exist = false)
    private Double morningMinMum;// 早餐最低消费
    @TableField(exist = false)
    private Double afternoonMinMum;// 午餐最低消费
    @TableField(exist = false)
    private Double evenningMinMum;// 晚餐最低消费
    @TableField(exist = false)
    private Double morningAllowance;
    @TableField(exist = false)
    private Double afternoonAllowance;
    @TableField(exist = false)
    private Double evenningAllowance;

    public enum MemberStatus {
        NORMAL("正常") {},
        INVALID("禁用") {},
        BLACKED("拉黑") {},
        ;

        @JsonValue
        private String value;

        MemberStatus(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

    }

    public enum Active {
        G("较多活动/Active") {},
        Z("中等活动/Moderate activity") {},
        L("轻体力活动/Low Active") {},
        D("久坐/Setting") {};

        private String value;

        Active(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }


}
